UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'B0HhO06Zccb+qzoqW/e5USH/NIrr272Xx2Rxo2dvVmg='
WHERE
key_id = '8ce01bf7c0418db8912a3a83d848c44316b1894ba727aaff1bdeb13bbee42357'
AND (
token = 'B0HhO06Zccb+qzoqW/e5USH/NIrr272Xx2Rxo2dvVmg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)