UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'h+q0fDgGpedxzFxGNbhqsLuN74SEjeYvmXeAyfit+mU=' 
WHERE 
  key_id = '42826134a7e5cd7d01087d7a51a2624948a615f7aeb47a54b134b92da7a1a782' 
  AND (
    token = 'h+q0fDgGpedxzFxGNbhqsLuN74SEjeYvmXeAyfit+mU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018