UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YcMSuRQsig1KiNoaZxBj2JpN6hvtc4CQg3+wYZb/Bjk=' 
WHERE 
  key_id = '713310ae6dcb41d3b6ed6856f9d7827cb00a5cbe85d208ac035d09f46bd13089' 
  AND (
    token = 'YcMSuRQsig1KiNoaZxBj2JpN6hvtc4CQg3+wYZb/Bjk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00062