UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'JiDMAzBa35bo4bDuUmxmct2fPiI7Fp0NEfvxbatuRXY='
WHERE
key_id = 'c3230bbc5b99055a1362e4738636707cfb23eb5937db8181d2e31efadc522c1b'
AND (
token = 'JiDMAzBa35bo4bDuUmxmct2fPiI7Fp0NEfvxbatuRXY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)