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