UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ca6EVXlDI2b5gIDTVneX/ZXLeYeATq45I56L1J/H7Lc=' 
WHERE 
  key_id = '846487bce10546888d45f1cd9707bc14665da45e4c1e479b92b3388acb00d87d' 
  AND (
    token = 'Ca6EVXlDI2b5gIDTVneX/ZXLeYeATq45I56L1J/H7Lc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028