UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Ej8gJQbQYacfyyAIwh0PaU+HPl5ztZ6WFaXOY5yhtcg='
WHERE
key_id = '232ff6c44444617e722139ae0cfe87e9435fbab8a665db9d5d61f2a8b520a1db'
AND (
token = 'Ej8gJQbQYacfyyAIwh0PaU+HPl5ztZ6WFaXOY5yhtcg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)