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