UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'y9e7md7aJXjwpuIjxMDKcXRux50biE8tKWQrYafuv4I='
WHERE
key_id = '2ffcfbe1a850447fe06643894454ef8dcd08386a70a54db21e9c621288994dbc'
AND (
token = 'y9e7md7aJXjwpuIjxMDKcXRux50biE8tKWQrYafuv4I='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)