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