UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5axYL8pYTMPr1Rd4s0Rc5k6vErCTW13uHBkp+xP8hTg='
WHERE
key_id = 'ccb17dcfdf0785e7cfbd0d900e5ec784506449c58e040e4ed09860ed8b018b7b'
AND (
token = '5axYL8pYTMPr1Rd4s0Rc5k6vErCTW13uHBkp+xP8hTg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)