UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4AVU7PtVhee053kpPGYxUv6uC5ibRoqwfC82akvWMTw='
WHERE
key_id = 'e3e95fbab0cb25029a0cb175cc6b57e714c510059f378dfd637364ab24a29dab'
AND (
token = '4AVU7PtVhee053kpPGYxUv6uC5ibRoqwfC82akvWMTw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)