UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'RD80ndvDZ/3ay+g35i+pOMdNTFBRATA+aPJnGsL4mfU='
WHERE
key_id = 'e95302e609b772884b81b4e39416b3d435bb58ac160bc4a258b6dee80acd04bc'
AND (
token = 'RD80ndvDZ/3ay+g35i+pOMdNTFBRATA+aPJnGsL4mfU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)