UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'WqgMcgbGkDvZSYBAafKRRirIugKGNlCI79AY45opGj0='
WHERE
key_id = 'a71d77c06e8f9f667e67c3b539c7d846aede36cd233d5f999b017b47dd70f613'
AND (
token = 'WqgMcgbGkDvZSYBAafKRRirIugKGNlCI79AY45opGj0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)