UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '40v6YfR+7maKgNpdCHbZ7ca3Qy6pz4yr7S40cZKlreM=' 
WHERE 
  key_id = 'd0b974d1c72b02c1255ba6b47b0c81495a7cc85499465a3e3d13ff1dc2dd2801' 
  AND (
    token = '40v6YfR+7maKgNpdCHbZ7ca3Qy6pz4yr7S40cZKlreM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00055