UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'EDwzAaLTn0s9eWB/HP8JGakTkZk8EqYUWjgAL+awAEU='
WHERE
key_id = '944e344aaf3f6923b0dbfc7eda2576e0aaf1aaefd9b85bf251f21be0e145795a'
AND (
token = 'EDwzAaLTn0s9eWB/HP8JGakTkZk8EqYUWjgAL+awAEU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)