UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lQDJDekFe1Vk3O7x+2v4n0eRGBqnghby5u7JSuEvUTA=' 
WHERE 
  key_id = 'cd74f069d52aafed1f62f7e8cb307174462c6b8174ab022495bce07d763c65e7' 
  AND (
    token = 'lQDJDekFe1Vk3O7x+2v4n0eRGBqnghby5u7JSuEvUTA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049