UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TUTWb1enQwcnaN5reol4M4Eoh2BnC33cRsok6mu2DF4='
WHERE
key_id = '8abe584be7162bee9eade1bbe12cf9d2be48f13d67ae4e95017b3cc2b29b24db'
AND (
token = 'TUTWb1enQwcnaN5reol4M4Eoh2BnC33cRsok6mu2DF4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)