UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kvY2YhjLkwMWszySbzzoiCf1lQZXjNam8ECai7lsIPA='
WHERE
key_id = '838d05ac9d7a0c868d73047d36473d8e7bf1182c6c9164180ce263e2136b4785'
AND (
token = 'kvY2YhjLkwMWszySbzzoiCf1lQZXjNam8ECai7lsIPA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)