UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ou07z5JouMdATRlsr7g7OfqbBzSXduTT5JfssUC+Ke4=' 
WHERE 
  key_id = 'a4ece5a53f4dd5f99f0991960efede21f163db8493cd26f8d484622908faba2f' 
  AND (
    token = 'ou07z5JouMdATRlsr7g7OfqbBzSXduTT5JfssUC+Ke4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051