UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RnpRLZBIZWJedsGXcQLYcI9wP+pDVt9+zlhYwLm7Fv4=' 
WHERE 
  key_id = 'bd673f842799f06e699995e07c0c2244761b6d5a24c3683615d61d0fc1563266' 
  AND (
    token = 'RnpRLZBIZWJedsGXcQLYcI9wP+pDVt9+zlhYwLm7Fv4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028