UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RBbFyZhkMGkbLSi6vxSknO2Kj6m0exJ50hFZI88X5Xc=' 
WHERE 
  key_id = 'ac2ba9a7e423a599da56fe5160c3d64e2a0876e23992ff339bbbecaf61657370' 
  AND (
    token = 'RBbFyZhkMGkbLSi6vxSknO2Kj6m0exJ50hFZI88X5Xc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027