UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'higIn30XYAN+cpjlgQqIr0KmmdPYwIlL5N1cC0AJsDU=' 
WHERE 
  key_id = '324b814a1991ca62ae2a0f804bf0b95e68f2718a27850ca26c4ac14c020009db' 
  AND (
    token = 'higIn30XYAN+cpjlgQqIr0KmmdPYwIlL5N1cC0AJsDU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018