UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0BtkJ6XWq8khZVefQZERA15MBD0ZPXQHSbOKZ8rcmwU='
WHERE
key_id = 'b16d46e17fce0131b8d97fb1b439aa1f3c401b0541094151075018da8847028c'
AND (
token = '0BtkJ6XWq8khZVefQZERA15MBD0ZPXQHSbOKZ8rcmwU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)