UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AQ4niiHp6mLyuV9YPFihpazJuPjnkN8X5dpHNWvRu2Y=' 
WHERE 
  key_id = '51e2e525a8c6d831ba573f830b645a2fadaf8106b74f7fb44d1360a04b9119ca' 
  AND (
    token = 'AQ4niiHp6mLyuV9YPFihpazJuPjnkN8X5dpHNWvRu2Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022