UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jVd03eiCeU8IVArCsO8ViKyCNHPm+UKem9wfWriGC+8=' 
WHERE 
  key_id = '04c92233f3088b727d61e48d3002794f4f9b6cf833e7cae1300356b22efeefbb' 
  AND (
    token = 'jVd03eiCeU8IVArCsO8ViKyCNHPm+UKem9wfWriGC+8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040