UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hEAsMGYkATHJBJ3KJEyR3SoK5XALfgJ7XEzjuUl4Z+g=' 
WHERE 
  key_id = '47d2114ff530849386f54d8ce092606c109004b223a77361bd8881cbc8e132f2' 
  AND (
    token = 'hEAsMGYkATHJBJ3KJEyR3SoK5XALfgJ7XEzjuUl4Z+g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017