UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wRd3FY4Odn6NhCebyho6MdvVEhD4YZmBeatHvdil3I4='
WHERE
key_id = '91d1a45c08f0c658b47ffcfc7614a16e1c55d48bc0f5593169188b85b74a5223'
AND (
token = 'wRd3FY4Odn6NhCebyho6MdvVEhD4YZmBeatHvdil3I4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)