UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cgz2b88lQaBPUTWTxeoT+niLX5cdbTsYEuRBU4aZeN0='
WHERE
key_id = '1ca27c1ebdade1c0eac74e997c9b8a0d392fe55129025e71170c95f2b43f4c69'
AND (
token = 'cgz2b88lQaBPUTWTxeoT+niLX5cdbTsYEuRBU4aZeN0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)