UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6LtycHFdl5HiyufJdm7+6ZKixqL40qZoVfpo8ogzAvM=' 
WHERE 
  key_id = '47370fa7f14afb52845237f1fd29cc840671b17851cca9537937dc7cfd0ae032' 
  AND (
    token = '6LtycHFdl5HiyufJdm7+6ZKixqL40qZoVfpo8ogzAvM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029