UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PC2fym9dDJJcHoiyBADw9g0ChRKrt+5HIyN5jt+XCjc=' 
WHERE 
  key_id = '89b285683a874090044b14acd6e605309160e5ecec897cb821d11da283d741ab' 
  AND (
    token = 'PC2fym9dDJJcHoiyBADw9g0ChRKrt+5HIyN5jt+XCjc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00057