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