UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IkuKFARZvTrEhMfNEO4K57KKowh9tIMzATZbfcvL81c=' 
WHERE 
  key_id = '87da55802523b10b0f71cb406f06344c54b6c16ba4996bd2f1262bec4532497e' 
  AND (
    token = 'IkuKFARZvTrEhMfNEO4K57KKowh9tIMzATZbfcvL81c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026