UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wdZBRHatqb2w96nv848IV1WKTKmTGadOq+vcsHTZPls='
WHERE
key_id = 'd8c490b85e3190ac228a24afbad20d861df7418d5258cdb14ce745bd2198a3ac'
AND (
token = 'wdZBRHatqb2w96nv848IV1WKTKmTGadOq+vcsHTZPls='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)