UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'E1kptJ9tlr7Pu186nCYpDEgwdoKdhsaKcHBs9Umud9I='
WHERE
key_id = '370634039566bea77a8b693fc974cf2b4e2f2902422c9e509971afcaff0fb1e5'
AND (
token = 'E1kptJ9tlr7Pu186nCYpDEgwdoKdhsaKcHBs9Umud9I='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)