UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5aG0fXr5hhyAo6xaNG07E7aXJ8TGkXfRcPSR9cSrWcY='
WHERE
key_id = 'be56f65b6da0541177d61260a22581032c5589361def99a3757559f81c51cdc3'
AND (
token = '5aG0fXr5hhyAo6xaNG07E7aXJ8TGkXfRcPSR9cSrWcY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)