UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FUCn81Pcqr5HR6wC9neieN0dToqukZ6VIVDuP88p3EI=' 
WHERE 
  key_id = '518b6ee43857a925872a3e8a63847e324aaf872505977e231c6cc0b0b6c2ea7b' 
  AND (
    token = 'FUCn81Pcqr5HR6wC9neieN0dToqukZ6VIVDuP88p3EI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031